package com.slicktechnologies.client.views.settings.employee;
import com.google.gwt.event.dom.client.ClickEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.*;
import com.simplesoftwares.client.library.appstructure.search.*;
import com.simplesoftwares.client.library.appstructure.formscreen.FormScreen;
import com.simplesoftwares.client.library.appstructure.formscreen.FormScreenPresenter;
import com.simplesoftwares.client.library.appstructure.formtablescreen.*;
import com.slicktechnologies.shared.*;
import com.slicktechnologies.shared.common.*;
import com.slicktechnologies.shared.common.businessprocesslayer.*;
import com.slicktechnologies.shared.common.businessunitlayer.*;
import com.slicktechnologies.shared.common.helperlayer.*;
import com.slicktechnologies.shared.common.personlayer.*;
import com.slicktechnologies.shared.common.productlayer.*;

import com.simplesoftwares.rebind.annatonations.EntityNameAnnotation;
import com.google.gwt.core.shared.GWT;
import com.simplesoftwares.client.library.appstructure.SearchPopUpScreen;
import com.simplesoftwares.client.library.appstructure.SuperTable;
import com.slicktechnologies.client.utility.GeneratedVariableRefrence;
import com.simplesoftwares.client.library.appskeleton.AppMemory;
import com.simplesoftwares.client.library.mywidgets.ObjectListBox;
import com.slicktechnologies.shared.common.paymentlayer.*;
import com.google.gwt.event.dom.client.*;
/**
 *  FormTableScreen presenter template
 */
public class EmployeePresenter extends FormScreenPresenter<Employee>  {

	//Token to set the concrete form
	EmployeeForm form;

	
	
	public EmployeePresenter (FormScreen<Employee> view,
			Employee model) {
		super(view, model);
		form=(EmployeeForm) view;
		
		form.getSearchpopupscreen().content.setSize("100%","100%");
		
	}

	/**
	 * Method template to set the processBar events
	 */
	@Override
	public void reactToProcessBarEvents(ClickEvent e) 
   {

		InlineLabel lbl= (InlineLabel) e.getSource();
		if(lbl.getText().contains("New"))
		{
			form.setToNewState();
			this.initalize();
		}
		
	}
	
	

	

	@Override
	public void reactOnPrint() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void reactOnEmail() {
		// TODO Auto-generated method stub
		
	}

	/**
	 * Method template to set new model
	 */
	@Override
	protected void makeNewModel() {
		
		model=new Employee();
	}
	
	/*
	 * Method template to set Myquerry object
	 */
	public MyQuerry getEmployeeQuery()
	{
		MyQuerry quer=new MyQuerry(new Vector<Filter>(), new Employee());
		return quer;
	}
	
	public void setModel(Employee entity)
	{
		model=entity;
	}
	
	public static void initalize()
	{
			// EmployeePresenterTable gentableScreen=GWT.create( EmployeePresenterTable.class);
			
			EmployeeForm  form=new  EmployeeForm();
			//
			

			   EmployeePresenterTable gentableSearch=new EmployeePresenterTableProxy();
			   gentableSearch.setView(form);
				gentableSearch.applySelectionModle();
			    EmployeePresenterSearch.staticSuperTable=gentableSearch;
			    EmployeePresenterSearch searchpopup=new EmployeePresenterSearchProxy();
			    form.setSearchpopupscreen(searchpopup);
			
			 EmployeePresenter  presenter=new  EmployeePresenter  (form,new Employee());
			AppMemory.getAppMemory().stickPnel(form);
			
			
		 
	}
	
	
		@EntityNameAnnotation(EntityName = "com.slicktechnologies.shared.common.personlayer.Employee")
		 public static class  EmployeePresenterTable extends SuperTable<Employee> implements GeneratedVariableRefrence{

			@Override
			public Object getVarRef(String varName) {
				// TODO Auto-generated method stub
				return null;
			}

			@Override
			public void createTable() {
				// TODO Auto-generated method stub
				
			}

			@Override
			protected void initializekeyprovider() {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void addFieldUpdater() {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void setEnable(boolean state) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void applyStyle() {
				// TODO Auto-generated method stub
				
			}} ;
			
			@EntityNameAnnotation(EntityName = "com.slicktechnologies.shared.common.personlayer.Employee")

			 public static class  EmployeePresenterSearch extends SearchPopUpScreen<Employee>{

				@Override
				public MyQuerry getQuerry() 
				{
					// TODO Auto-generated method stub
					return null;
				}};
				
	 

	
	
	
	
	

	  
	  
	

}
